﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class TaoBaoApi_TB_downorder : System.Web.UI.Page
{
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = BLL.Common.GetWSMThemes();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            new TBCommon().BindTBShop(ddlShop);
            new TBCommon().BindTBTradeStatus(ddlStatus);
            ddlStatus.Items.Add(new ListItem("全部状态", "ALL"));
            ddlStatus.SelectedValue = "WAIT_SELLER_SEND_GOODS";
        }
    }
    protected void btnNext_Click(object sender, EventArgs e)
    {
        if (ddlShop.SelectedIndex < 0)
        {
            new TBCommon().ShowMessage(Page, "请选择一个淘宝店铺。");
            return;
        }
        if (!CheckInput())
            return;
        string start = txtStart.Text.Trim() + " 00:00:00";
        string end = txtEnd.Text.Trim() + " 23:59:59";
        string status = ddlStatus.SelectedValue;
        string user = ddlShop.SelectedItem.Text;
        Response.Redirect("tb_downorder2.aspx?start=" + start + "&end=" + end + "&status=" + status + "&user=" + user);
    }
    bool CheckInput()
    {
        try
        {
            if (txtStart.Text.Trim().Length > 0)
                Convert.ToDateTime(txtStart.Text);
            if (txtEnd.Text.Trim().Length > 0)
                Convert.ToDateTime(txtEnd.Text);
            return true;
        }
        catch
        {
            new TBCommon().ShowMessage(Page, "日期格式输入不正确。");
            return false;
        }
    }
}
